package com.zf.springdoc.openapi3.controller;

import com.zf.common.core.result.RestResponse;
import com.zf.springdoc.openapi3.entity.Person;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/openapi3")
public class Openapi3Controller {
    @Operation(summary = "test接口", description = "测试接口说明")
    @GetMapping("/test")
    public RestResponse<?> test(@Parameter(name = "username", description = "用户名") @RequestParam(name = "username") String username,
                                @Parameter(name = "age", description = "密码") @RequestParam(name = "age") Integer age) {
        Person person = new Person();
        person.setUsername(username);
        person.setAge(age);
        return RestResponse.success(person);
    }

    @Operation(summary = "list接口")
    @GetMapping("/list")
    public Person list(@Parameter(name = "userId", description = "用户id") @RequestParam(name = "userId") String userId) {
        return new Person();
    }

    @Operation(summary = "add接口")
    @PostMapping("/add")
    public Person add(@RequestBody Person person) {
        return person;
    }

}
